/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.st.entity;

import org.hibernate.validator.constraints.Length;

import java.util.Date;

import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.fasterxml.jackson.annotation.JsonFormat;

import java.util.List;

import com.jeesite.common.collect.ListUtils;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;

/**
 * 采购单Entity
 *
 * @author HOHD
 * @version 2020-12-16
 */
@Table(name = "st_purchase_bill", alias = "a", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "bill_no", attrName = "billNo", label = "单据号"),
        @Column(name = "bill_date", attrName = "billDate", label = "单据日期"),
        @Column(name = "buyer_code", attrName = "buyerCode", label = "采购员编号"),
        @Column(name = "buyer_name", attrName = "buyerName", label = "采购员", queryType = QueryType.LIKE),
        @Column(name = "dept_code", attrName = "deptCode", label = "部门编码"),
        @Column(name = "dept_name", attrName = "deptName", label = "部门", queryType = QueryType.LIKE),
        @Column(name = "supplier_id", attrName = "supplierId", label = "供应商"),
        @Column(name = "in_or_out", attrName = "inOrOut", label = "退/购货"),
        @Column(name = "money_type", attrName = "moneyType", label = "币别"),
        @Column(name = "contract_no", attrName = "contractNo", label = "合同编号"),
        @Column(name = "buy_type", attrName = "buyType", label = "采购类别"),
        @Column(name = "buy_status", attrName = "buyStatus", label = "采购状态"),
        @Column(name = "pay_where", attrName = "payWhere", label = "付款条件"),
        @Column(name = "delivery_way", attrName = "deliveryWay", label = "交货方式"),
        @Column(name = "approve_state", attrName = "approveState", label = "审批状态"),
        @Column(name = "approve_man_code", attrName = "approveManCode", label = "审批人编码"),
        @Column(name = "approve_man_name", attrName = "approveManName", label = "审批人", queryType = QueryType.LIKE),
        @Column(name = "create_by", attrName = "createBy", label = "创建者", isUpdate = false, isQuery = false),
        @Column(name = "create_date", attrName = "createDate", label = "创建时间", isUpdate = false, isQuery = false),
        @Column(name = "update_by", attrName = "updateBy", label = "更新者", isQuery = false),
        @Column(name = "update_date", attrName = "updateDate", label = "更新时间", isQuery = false),
        @Column(name = "remarks", attrName = "remarks", label = "备注信息", queryType = QueryType.LIKE),
}, orderBy = "a.update_date DESC", joinTable = {
        @JoinTable(on = "s.id=a.supplier_id", type = Type.LEFT_JOIN, attrName = "supplier", entity = StSupplierRecord.class, alias = "s")
}
)
public class StPurchaseBill extends DataEntity<StPurchaseBill> {

    private static final long serialVersionUID = 1L;
    private String billNo;        // 单据号
    private Date billDate;        // 单据日期
    private String buyerCode;        // 采购员编号
    private String buyerName;        // 采购员
    private String deptCode;        // 部门编码
    private String deptName;        // 部门
	private StSupplierRecord supplier;
    private String supplierId;        // 供应商
    private Integer inOrOut;        // 退/购货
    private Integer moneyType;        // 币别
    private String contractNo;        // 合同编号
    private Integer buyType;        // 采购类别

    private Integer buyStatus;
    private String payWhere;        // 付款条件
    private Integer deliveryWay;        // 交货方式
    private Integer approveState;        // 审批状态
    private String approveManCode;        // 审批人编码
    private String approveManName;        // 审批人
    private List<StPurchaseDetail> stPurchaseDetailList = ListUtils.newArrayList();        // 子表列表

    public StPurchaseBill() {
        this(null);
    }

    public StPurchaseBill(String id) {
        super(id);
    }

    public Integer getBuyStatus() {
        return buyStatus;
    }

    public void setBuyStatus(Integer buyStatus) {
        this.buyStatus = buyStatus;
    }

    public StSupplierRecord getSupplier() {
		return supplier;
	}

	public void setSupplier(StSupplierRecord supplier) {
		this.supplier = supplier;
	}

	@Length(min = 0, max = 20, message = "单据号长度不能超过 20 个字符")
    public String getBillNo() {
        return billNo;
    }

    public void setBillNo(String billNo) {
        this.billNo = billNo;
    }

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    public Date getBillDate() {
        return billDate;
    }

    public void setBillDate(Date billDate) {
        this.billDate = billDate;
    }

    @Length(min = 0, max = 20, message = "采购员编号长度不能超过 20 个字符")
    public String getBuyerCode() {
        return buyerCode;
    }

    public void setBuyerCode(String buyerCode) {
        this.buyerCode = buyerCode;
    }

    @Length(min = 0, max = 5, message = "采购员长度不能超过 5 个字符")
    public String getBuyerName() {
        return buyerName;
    }

    public void setBuyerName(String buyerName) {
        this.buyerName = buyerName;
    }

    @Length(min = 0, max = 20, message = "部门编码长度不能超过 20 个字符")
    public String getDeptCode() {
        return deptCode;
    }

    public void setDeptCode(String deptCode) {
        this.deptCode = deptCode;
    }

    @Length(min = 0, max = 20, message = "部门长度不能超过 20 个字符")
    public String getDeptName() {
        return deptName;
    }

    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }

    @Length(min = 0, max = 36, message = "供应商长度不能超过 36 个字符")
    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    public Integer getInOrOut() {
        return inOrOut;
    }

    public void setInOrOut(Integer inOrOut) {
        this.inOrOut = inOrOut;
    }

    public Integer getMoneyType() {
        return moneyType;
    }

    public void setMoneyType(Integer moneyType) {
        this.moneyType = moneyType;
    }

    @Length(min = 0, max = 20, message = "合同编号长度不能超过 20 个字符")
    public String getContractNo() {
        return contractNo;
    }

    public void setContractNo(String contractNo) {
        this.contractNo = contractNo;
    }

    public Integer getBuyType() {
        return buyType;
    }

    public void setBuyType(Integer buyType) {
        this.buyType = buyType;
    }

    @Length(min = 0, max = 20, message = "付款条件长度不能超过 20 个字符")
    public String getPayWhere() {
        return payWhere;
    }

    public void setPayWhere(String payWhere) {
        this.payWhere = payWhere;
    }

    public Integer getDeliveryWay() {
        return deliveryWay;
    }

    public void setDeliveryWay(Integer deliveryWay) {
        this.deliveryWay = deliveryWay;
    }

    public Integer getApproveState() {
        return approveState;
    }

    public void setApproveState(Integer approveState) {
        this.approveState = approveState;
    }

    @Length(min = 0, max = 20, message = "审批人编码长度不能超过 20 个字符")
    public String getApproveManCode() {
        return approveManCode;
    }

    public void setApproveManCode(String approveManCode) {
        this.approveManCode = approveManCode;
    }

    @Length(min = 0, max = 5, message = "审批人长度不能超过 5 个字符")
    public String getApproveManName() {
        return approveManName;
    }

    public void setApproveManName(String approveManName) {
        this.approveManName = approveManName;
    }

    public List<StPurchaseDetail> getStPurchaseDetailList() {
        return stPurchaseDetailList;
    }

    public void setStPurchaseDetailList(List<StPurchaseDetail> stPurchaseDetailList) {
        this.stPurchaseDetailList = stPurchaseDetailList;
    }

}